package com.weishi.project.training.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.weishi.common.utils.StringUtils;
import com.weishi.framework.aspectj.lang.annotation.Excel;
import lombok.Data;
import lombok.Getter;

@Data
public class AchievementExcel {

    @Excel(name = "航道 id")
    private Integer channelId;

    @Excel(name = "日期")
    private String day;

    @Excel(name = "二级项目名称")
    private String secondLevelName;

    @Excel(name = "实际公里数")
    private Double rowingKilometers;
    private int rowingClassHour;

    @Excel(name = "小组名称")
    private String groupName;

    @Excel(name = "航道名称")
    private String channelName;

    @Excel(name = "艇支")
    private String boatType;

    @Excel(name = "分段成绩")
    private String segmentedTiming;

    @Excel(name = "总成绩")
    private String achievement;

    @Excel(name = "桨频")
    private String propellerFrequency;

    @Excel(name = "姓名")
    private String sportsmanName;

    private int sportsmanId;

    @Excel(name = "位置")
    private Integer position;

    @Excel(name = "左桨右桨")
    private Integer oarType;

    @Excel(name = "左桨右桨")
    private String oarTypeName;

    @Excel(name = "心率")
    private String heartRate;

    @Excel(name = "乳酸")
    private String lacticAcid;

    @Excel(name = "功率")
    private String power;

    @Excel(name = "瓦特")
    private String watt;

    //训练项目类型
    @TableField(exist = false)
    private String type;

    // 项目类型
    @TableField(exist = false)
    private String firstLevelName;

    // 小组 id
    @TableField(exist = false)
    private Integer groupId;

    // 训练课 id
    @TableField(exist = false)
    private Integer trainingDayId;

    /**
     * 平均功率
     */
    @TableField(exist = false)
    private String averagePower;

    /**
     * 平均桨频
     */
    @TableField(exist = false)
    private Double averagePropellerFrequency;

    /**
     * 平均瓦特
     */
    @TableField(exist = false)
    private Integer averageWatt;

    /**
     * 桨数
     */
    @TableField(exist = false)
    private Integer pulpNumber;

    /**
     * 分段 功率
     */
    @TableField(exist = false)
    private String segmentPower;

    /**
     * 峰力
     */
    @TableField(exist = false)
    private Double peakForce;

    /**
     * 均力
     */
    @TableField(exist = false)
    private Double averageForce;

    /**
     * （手动输入）平均船速
     */
    //@TableField(exist = false)
    private String averageSpeed;

    /**
     * 分段 桨频
     */
    @TableField(exist = false)
    private String segmentPropellerFrequency;

    /**
     * 分段心率
     */
    @TableField(exist = false)
    private String segmentHeartRate;

    /**
     * 分段 瓦特
     */
    @TableField(exist = false)
    private String segmentWatt;

    /**
     * 最大心率
     */
    @TableField(exist = false)
    private Integer maxHeartRate;

    /**
     * 训练模式 0、默认公里数计时，1、默认时长计公里数
     */
    @TableField(exist = false)
    private Integer trainingMode;

    /**
     * 平均心率
     */
    @TableField(exist = false)
    private Integer averageHeartRate;

    /**
     * 其它心率
     */
    @TableField(exist = false)
    private String otherHeartRate;

    /**
     * 其它乳酸
     */
    @TableField(exist = false)
    private String otherLacticAcid;

    /**
     * 船速仪 id
     */
    @TableField(exist = false)
    private String shipSpeedId;

    /**
     * 最大船速
     */
    @TableField(exist = false)
    private String maxSpeed;

    /**
     * 分段船速
     */
    @TableField(exist = false)
    private String sectionalSpeed;

    /**
     * 批次数字
     */
    @TableField(exist = false)
    private Integer batch;

    /**
     * 批次名称
     */
    @TableField(exist = false)
    private String batchName;

    /**
     * 批次名称
     */
    @TableField(exist = false)
    private Double speed;




    public AchievementWater getAchievementWater(AchievementExcel achievementExcel){
        AchievementWater achievementWater = new AchievementWater();
        achievementWater.setDay(achievementExcel.getDay());
        achievementWater.setGroupName(achievementExcel.getGroupName());
        achievementWater.setBatchName(achievementExcel.getBatchName());
        achievementWater.setChannelName(achievementExcel.getChannelName());
        achievementWater.setShipSpeedId(achievementExcel.getShipSpeedId());
        achievementWater.setBoatType(achievementExcel.getBoatType());
        achievementWater.setRowingKilometers(achievementExcel.getRowingKilometers());
        achievementWater.setRowingClassHour(achievementExcel.getRowingClassHour());
        achievementWater.setSportsmanName(achievementExcel.getSportsmanName());
        achievementWater.setAchievement(achievementExcel.getAchievement());
        achievementWater.setSegmentedTiming(achievementExcel.getSegmentedTiming());
        if(!"".equals(achievementExcel.getPropellerFrequency()) && StringUtils.isNotNull(achievementExcel.getPropellerFrequency())){
            achievementWater.setSegmentPropellerFrequency(achievementExcel.getPropellerFrequency());
        }
        achievementWater.setAverageSpeed(achievementExcel.getAverageSpeed());
        achievementWater.setMaxSpeed(achievementExcel.getMaxSpeed());
        achievementWater.setPulpNumber(achievementExcel.getPulpNumber());
        achievementWater.setSectionalSpeed(achievementExcel.getSectionalSpeed());
        achievementWater.setSegmentPropellerFrequency(achievementExcel.getPropellerFrequency());
        achievementWater.setOarTypeName(achievementExcel.getOarTypeName());
        achievementWater.setPosition(achievementExcel.getPosition());
        achievementWater.setHeartRate(achievementExcel.getHeartRate());
        achievementWater.setMaxHeartRate(achievementExcel.getMaxHeartRate());
        achievementWater.setAverageHeartRate(achievementExcel.getAverageHeartRate());
        achievementWater.setOtherHeartRate(achievementExcel.getOtherHeartRate());
        achievementWater.setOtherLacticAcid(achievementExcel.getOtherLacticAcid());
        achievementWater.setFirstLevelName(achievementExcel.getFirstLevelName());
        achievementWater.setAveragePropellerFrequency(achievementExcel.getAveragePropellerFrequency());

        return achievementWater;
    }

    public AchievementLand getAchievementLand(AchievementExcel achievementExcel){
        AchievementLand achievementLand = new AchievementLand();
        achievementLand.setDay(achievementExcel.getDay());
        achievementLand.setGroupName(achievementExcel.getGroupName());
        achievementLand.setSportsmanName(achievementExcel.getSportsmanName());
        if(achievementExcel.getTrainingMode() == 0){
            achievementLand.setRowingKilometers(achievementExcel.getRowingKilometers());
        }
        achievementLand.setRowingClassHour(achievementExcel.getRowingClassHour());
        achievementLand.setAchievement(achievementExcel.getAchievement());
        achievementLand.setAveragePower(achievementExcel.getAveragePower());
        achievementLand.setAveragePropellerFrequency(achievementExcel.getAveragePropellerFrequency());
        achievementLand.setAverageWatt(achievementExcel.getAverageWatt());
        achievementLand.setSegmentedTiming(achievementExcel.getSegmentedTiming());
        achievementLand.setPulpNumber(achievementExcel.getPulpNumber());
        achievementLand.setSegmentPower(achievementExcel.getSegmentPower());
        achievementLand.setPeakForce(achievementExcel.getPeakForce());
        achievementLand.setAverageForce(achievementExcel.getAverageForce());
        achievementLand.setAverageSpeed(achievementExcel.getAverageSpeed());
        achievementLand.setSegmentPropellerFrequency(achievementExcel.getSegmentPropellerFrequency());
        achievementLand.setSegmentHeartRate(achievementExcel.getSegmentHeartRate());
        achievementLand.setSegmentWatt(achievementExcel.getSegmentWatt());
        achievementLand.setMaxHeartRate(achievementExcel.getMaxHeartRate());
        achievementLand.setAverageHeartRate(achievementExcel.getAverageHeartRate());
        achievementLand.setOtherHeartRate(achievementExcel.getOtherHeartRate());
        achievementLand.setOtherLacticAcid(achievementExcel.getOtherLacticAcid());
        achievementLand.setFirstLevelName(achievementExcel.getFirstLevelName());
        if(StringUtils.isNotNull(achievementExcel.getSpeed()) && !"".equals(achievementExcel.getSpeed())){
            achievementLand.setAverageSpeed(achievementExcel.getSpeed().toString());
        }
        return achievementLand;
    }

    @Getter
    @Data
    public class AchievementWater{
        @Excel(name = "训练日")
        private String day;

        @Excel(name = "训练组")
        private String groupName;

        @Excel(name = "小组")
        private String batchName;

        @Excel(name = "航道")
        private String channelName;

        @Excel(name = "船速仪")
        private String shipSpeedId;

        @Excel(name = "艇种")
        private String boatType;

        @Excel(name = "公里数")
        private Double rowingKilometers;

        @Excel(name = "时长")
        private int rowingClassHour;

        @Excel(name = "运动员")
        private String sportsmanName;

        @Excel(name = "总成绩")
        private String achievement;

        @Excel(name = "分段成绩")
        private String segmentedTiming;

        @Excel(name = "平均桨频")
        private Double averagePropellerFrequency;

        @Excel(name = "平均船速")
        private String averageSpeed;

        @Excel(name = "最大船速")
        private String maxSpeed;

        @Excel(name = "桨数")
        private Integer pulpNumber;

        @Excel(name = "分段船速")
        private String sectionalSpeed;

        @Excel(name = "分段桨频")
        private String segmentPropellerFrequency;

        @Excel(name = "桨位")
        private String oarTypeName;

        @Excel(name = "号位")
        private Integer position;

        @Excel(name = "分段心率")
        private String heartRate;

        @Excel(name = "最大心率")
        private Integer maxHeartRate;

        @Excel(name = "平均心率")
        private Integer averageHeartRate;

        @Excel(name = "其它心率")
        private String otherHeartRate;

        @Excel(name = "其它乳酸")
        private String otherLacticAcid;

        @Excel(name = "项目类型")
        private String firstLevelName;


    }

    @Getter
    @Data
    public class AchievementLand{
        @Excel(name = "训练日")
        private String day;

        @Excel(name = "训练组")
        private String groupName;

        @Excel(name = "运动员")
        private String sportsmanName;

        @Excel(name = "公里数")
        private Double rowingKilometers;

        @Excel(name = "时长")
        private Integer rowingClassHour;

        @Excel(name = "总成绩")
        private String achievement;

        @Excel(name = "平均/500m")
        private String averagePower;

        @Excel(name = "平均桨频")
        private Double averagePropellerFrequency;

        @Excel(name = "平均瓦特")
        private Integer averageWatt;

        @Excel(name = "分段成绩")
        private String segmentedTiming;

        @Excel(name = "桨数")
        private Integer pulpNumber;

        @Excel(name = "分段功率")
        private String segmentPower;

        @Excel(name = "峰力")
        private Double peakForce;

        @Excel(name = "均力")
        private Double averageForce;

        @Excel(name = "速度")
        private String averageSpeed;

        @Excel(name = "分段桨频")
        private String segmentPropellerFrequency;

        @Excel(name = "分段心率")
        private String segmentHeartRate;

        @Excel(name = "分段瓦特")
        private String segmentWatt;

        @Excel(name = "最大心率")
        private Integer maxHeartRate;

        @Excel(name = "平均心率")
        private Integer averageHeartRate;

        @Excel(name = "其它心率")
        private String otherHeartRate;

        @Excel(name = "其它乳酸")
        private String otherLacticAcid;


        /*@Excel(name = "二级项目名称")
        private String secondLevelName;

        @Excel(name = "桨频")
        private String propellerFrequency;

        @Excel(name = "功率")
        private String power;

        @Excel(name = "瓦特")
        private Double watt;

        @Excel(name = "测功仪名称")
        private String dynamometerName;*/

        @Excel(name = "项目类型")
        private String firstLevelName;





    }

}
